﻿/******************************************************************
 *Company: http://www.xiaomutech.com/
 *fileName : card_header.h --- %{Cpp:License:ClassName}
 *Auth       : yhni (QQ:393320854)
 *Create    : 2022/1/25
 *Description   :
 *Histroy:
 *<Auth>    <Date>        <Ver>        <Content>
 *         2022/1/25
 *******************************************************************/
#ifndef CARD_HEADER_H
#define CARD_HEADER_H

#define change_endian_u32(v) ((((v) & 0xff) << 24) | ((((v) >> 8) & 0xff) << 16) | ((((v) >> 16) & 0xff) << 8) | ((((v) >> 24) & 0xff)))
#define change_endian_u16(v) ((((v) & 0xff) << 8) | ((((v) >> 8) & 0xff)))

#ifdef QT_USE_BIG_IMAGE
#define CARD_WIDTH          122
#define CARD_HEIGHT         150
#else
#define CARD_WIDTH          80
#define CARD_HEIGHT         105
#endif

enum CardPoint
{
    Card_Begin,

    Card_3,
    Card_4,
    Card_5,
    Card_6,
    Card_7,
    Card_8,
    Card_9,
    Card_10,
    Card_J,
    Card_Q,
    Card_K,
    Card_A,
    Card_2,

    Card_SJ,
    Card_BJ,

    Card_BG,
    Card_End
};

enum CardSuit
{
    Suit_Begin,

    Diamond,	// 方块
    Club,		// 梅花
    Heart,		// 红桃
    Spade,		// 黑桃

    Suit_End
};

typedef enum {
    AreaTop,
    AreaLeft,
    AreaBottom,
    AreaRight,
    AreaCenter,
} AreaType;

typedef struct
{
    CardPoint point;
    CardSuit suit;
} CardType;
#define CardTypeSize    sizeof(CardType)

enum HandType
{
    Hand_Unknown,			// 未知
    Hand_Pass,				// 过

    Hand_Single,			// 单
    Hand_Pair,				// 对

    Hand_Triple,			// 三个
    Hand_Triple_Single,		// 三带一
    Hand_Triple_Pair,		// 三带二

    Hand_Plane,				// 飞机，555_666
    Hand_Plane_Two_Single,	// 飞机带单，555_666_3_4
    Hand_Plane_Two_Pair,	// 飞机带双，555_666_33_44

    Hand_Seq_Pair,			// 连对，33_44_55(_66...)
    Hand_Seq_Single,		// 顺子，34567(8...)

    Hand_Bomb,				// 炸弹
    Hand_Bomb_Single,		// 炸弹带一个
    Hand_Bomb_Pair,			// 炸弹带一对
    Hand_Bomb_Two_Single,	// 炸弹带两单

    Hand_Bomb_Jokers,			// 王炸
    Hand_Bomb_Jokers_Single,	// 王炸带一个
    Hand_Bomb_Jokers_Pair,		// 王炸带一对
    Hand_Bomb_Jokers_Two_Single	// 王炸带两单
};


// 0/进入房间,1/离开,2/准备,3/叫分,4/发牌,5/出牌,6/结算
typedef enum {
    EnterIn,
    Exit,
    Ready,
    Call,
    SendCard,
    PlayCard,
    WinOver
} CardAction;

typedef enum
{
    Farmer,
    Lord,
} Role;

#endif // CARD_HEADER_H
